package com.jspx.txweb.dispatcher.handle;

import com.jspx.boot.sign.HttpStatusType;
import com.jspx.txweb.ActionInvocation;
import com.jspx.txweb.config.ActionConfig;
import com.jspx.txweb.dispatcher.Dispatcher;
import com.jspx.txweb.dispatcher.WebHandle;
import com.jspx.txweb.env.TXWeb;
import com.jspx.txweb.proxy.DefaultActionInvocation;
import com.jspx.txweb.result.MarkdownResult;
import com.jspx.txweb.support.ActionSupport;
import com.jspx.txweb.util.TXWebUtil;
import com.jspx.utils.StringUtil;
import com.jspx.utils.URLUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created by Administrator on 2017/6/17.
 * markdown格式解析
 */
public class MarkdownHandle extends ActionHandle {
    final public static  String  name = "md";


    @Override
    public void doing(HttpServletRequest request, HttpServletResponse response) throws Exception {

        //////////////////////////////////环境参数 begin
        Map<String, Object> envParams = createEnvironment( request, response);

        actionConfig = webConfigManager.getActionConfig((String)envParams.get(ActionSupport.Key_ActionName),Dispatcher.getMarkdownSuffix(), true);

        ActionInvocation actionInvocation = new DefaultActionInvocation(actionConfig, envParams,null, request, response);
        actionInvocation.initAction();
        actionInvocation.invoke();
        actionInvocation.setResultCode(ActionSupport.Markdown);
        actionInvocation.executeResult(new MarkdownResult());
        ////////////////////action end
    }
}
